﻿<?php
require_once('./inc/database.php');
require_once('./class/class.comments.php');
require_once('./inc/functions.php');
db_connect();

 class task
 {  /********members*********/
   private $task_id;
   public $project_id;
   public $user_id;
   public $task_status_id;
   public $task_time;
   public $task_date;
   public $task_content;
   public $task_urgency;
   public $task_link;
   public $task_attachments;
   public $Browser;
   public $Close_Date;
   public $Close_Name;
   public $Close_Time;
   public $task_project_status;
   /***************constrctor*******************/
   public function  task()
   	{
		$this->task_date=date('y-m-d');
		$time=getdate(time());
		$this->task_time=$time['hours'].':'.$time['minutes'].':'.$time['seconds'];
		$this->task_status_id=1;
		$this->task_id="";
		$this->project_id;
		$this->user_id;
		$this->task_content="";
		$this->task_urgency="";
		$this->task_link="";
		$this->task_attachments="";
		$this->Browser="";
		$this->Close_Date="";
		$this->Close_Name="";
		$this->Close_Time="";
		$this->task_project_status="";
	}
	
	
	
	/****************method******************************/
	public function  get_task_id()
		{
		return $this->task_id;	
				
		}
		
		public static function  createTaskFromArray($arrTask)

	{

		$task= new task();

		foreach ($arrTask as $key=>$item)

		{ 

		  $task->$key=$item;

		}

		

			return $task;

	

	}
		
		
	public function insert()
		{
		  	 $this->task_content=mysql_escape_string($this->task_content);
			 $stringinsert="INSERT INTO `task`
			 (`project_id`, `user_id`, `task_status_id`, `task_time`, `task_date`, `task_content`, `task_urgency`, `task_link`, `task_attachments`, `Browser`,`Close_Date`,`Close_Name`,`Close_Time`,`task_project_status`)
			   VALUES ($this->project_id,$this->user_id,$this->task_status_id,'$this->task_time',
			   '$this->task_date','$this->task_content','$this->task_urgency','$this->task_link',
			   '$this->task_attachments','$this->Browser','$this->Close_Date','$this->Close_Name','$this->Close_Time',$this->task_project_status)";
			 $queryinsert=mysql_query($stringinsert) or die(mysql_error().' '.$stringinsert);
			$this->task_id=mysql_insert_id();
			
		}
		
		
		
		
	public function update()
		{
		   if($this->task_id!=null || $this->task_id!="")
		   	{
			$this->task_content=mysql_escape_string($this->task_content);
			 $stringupdate="UPDATE `task` SET
			 `project_id`=$this->project_id,
			 `user_id`=$this->user_id,
			 `task_status_id`=$this->task_status_id,
			 `task_time`='$this->task_time',
			 `task_date`='$this->task_date',
			 `task_content`='$this->task_content',
			 `task_urgency`='$this->task_urgency',
			 `task_link`='$this->task_link',                      
			 `task_attachments`='$this->task_attachments',
			 `Browser`='$this->Browser',
			 `Close_Date`='$this->Close_Date',
			 `Close_Name`='$this->Close_Name',
			 `Close_Time`='$this->Close_Time',
			 `task_project_status`=$this->task_project_status
			  WHERE `task_id`=$this->task_id;
						  ";
			 $queryupdate=mysql_query($stringupdate) or die(mysql_error().' '.$stringupdate);
			 return true ;	
           	}
			return 0;
			
		}
		
		
		
		
		public function getby_id($task_id)//מקבלת id ומעדכנת את כל המשתנים הגלובלים 
		{
		 	$stringgetby_id="SELECT * FROM `task` WHERE `task_id`=$task_id";
			$querygetby_id=mysql_query($stringgetby_id) or die(mysql_error().' '.$stringgetby_id);
			$row=mysql_fetch_assoc($querygetby_id);
			if(mysql_affected_rows()>0)
				{
				    $this->task_date=$row['task_date'];
					$this->task_time=$row['task_time'];
					$this->task_status_id=$row['task_status_id'];
					$this->task_id=$row['task_id'];
					$this->project_id=$row['project_id'];
					$this->user_id=$row['user_id'];
					$this->task_content=$row['task_content'];
					$this->task_urgency=$row['task_urgency'];
					$this->task_link=$row['task_link'];
					$this->task_attachments=$row['task_attachments'];
					$this->Browser=$row['Browser'];
					$this->Close_Date=$row['Close_Date'];
					$this->Close_Name=$row['Close_Name'];
					$this->Close_Time=$row['Close_Time'];
					$this->task_project_status=$row['task_project_status'];
				   return true;
				}
			return 0;
		}
		
		 
		
		
	public function set_status($status_id)
	/*מקבל מספר של מצב הפניה 	
	  1-חדש 
	  2-התקבל
	  3-בטיפול
	  4-בוצע
	  5-נדחה
      ומשנה אותו 
	*/
		 {    if($this->task_id!="" && $this->task_id!=null)
		    	{
			      $this->task_status_id=$status_id; 
				  return true;
				}
				return false;
		 }
		 
		 
		 
		 
public function get_status_task()
		{
		        $stringstatus="SELECT  `task_status_id`  FROM `task` WHERE `task_id`= $this->task_id";
				$querystatus=mysql_query( $stringstatus)or die(mysql_error().' '. $stringstatus);
				$row=mysql_fetch_assoc($querystatus);
				return $row['task_status_id'];		
		}
		 
		 
		 
		 
public function get_comments()//מחזירה מערך עם כל התגובות של הפניה
{ 
   if($this->task_id!="" && $this->task_id!=null)
		{
			 $stringCom="SELECT * FROM `comments` WHERE 
			                     `task_id`=$this->task_id order by comment_date ASC ,comment_time  ASC";
			  $queryCom=mysql_query($stringCom) or die (mysql_error().' '.$stringCom);
			  $arr= array();
			  while($row=mysql_fetch_assoc($queryCom))
			  	{
					//$temp=new comments();
					//$temp->getby_id($row['comment_id']);
					$temp=comments::createCommentFromArray($row);
				 array_push($arr,$temp);	
				}
			 return $arr;
		}
			return 0;
}
			
public function get_browser_name()
{
	$st="SELECT * FROM `Browser` WHERE `id_Browser`=$this->Browser";
	$query=mysql_query($st) or die(mysql_error().' '.$st);
	$row=mysql_fetch_assoc($query);
	return $row['name_Browser'];
}
public static function get_name_status_task($id_task)
{
 $st="SELECT * FROM `task_status` WHERE `task_status_id`=$id_task";
 $query=mysql_query($st) or die (mysql_error().' ' .$st);
 $row=mysql_fetch_assoc($query);
 return $row['task_status'];	
}
public static function get_all_task()//מחזיר את כל הפניות שיש במערכת	
			{
			  	 $stringCom="
								 SELECT c.customer_name, p.project_name,t.* FROM `task` AS  t
								 INNER JOIN project  AS p ON ( p.project_id = t.project_id ) 
								 INNER JOIN customer AS c ON ( c.Id = p.project_customer ) 
								 ORDER BY `project_id`
							";
			     $queryCom=mysql_query($stringCom) or die (mysql_error().' '.$stringCom);
				
				 $arr= array();
				 while($row=mysql_fetch_assoc($queryCom))
				 	{ 
						//$temp=new task();
						//$temp->getby_id($row['task_id']);
						//$temp=task::createTaskFromArray($row);
					    array_push($arr,$row);	
				   }
				 return $arr;  
			}
			

public static function get_task_treatment($status)
	{
			$today=date('Y-m-d');
			$temp=strtotime($today);
 			$cov=strtotime("  Last Sunday", $temp);
 			$new=date('Y-m-d',$cov);
			$temp=strtotime($new);
			$cov=strtotime("+6 days", $temp);
			$end=date('Y-m-d',$cov);
			$st="SELECT * FROM `task` WHERE  `task_status_id`='$status' and task_date BETWEEN '$new' and '$end'";
			$query=mysql_query($st)or die (mysql_error().' ' .$st);
			
		return mysql_affected_rows();
		
	}
	
		
public function get_html_task()//מדפיס פורמט של פניה ותגובות
			{  
			  if($this->task_project_status!=1 || isset($_SESSION['Adimn']))
			  {  
			  $comments=$this->get_comments();//מערך של כל התגובות 
			?>
                 
                          <div id="task_content" >
                          
                       		 <div class="box_btn <?php if($this->task_status_id==5 ){ echo 'ssb';} ?> "
                              id="<?php echo $this->get_task_id(); ?>"  
                        			 onclick="show(<?php echo $this->get_task_id(); ?>)">+</div>
                            
                            <div id="info">
                             <span class="color_turkiz">
                                  # <?php echo $this->get_task_id();?>
                             </span>
                             <span class="color_turkiz">
								  <?php 
								      $date=$this->task_date;
                                      $date=explode('-',$date);
                                      echo $date[2].'/'.$date[1].'/'.$date[0];
                                   ?>
                              </span>
                               <span class="color_turkiz">
								  <?php 
								      $time=explode(':',$this->task_time);
                                      echo $time[0].':'.$time[1];
                                   ?>
                              </span>
                              <span class="color_turkiz">
								  <?php echo user::get_name($this->user_id);?>
                              </span>
                              <span><?php echo $this->get_browser_name(); ?></span>
                             </div> 
                              <p id='dakindakin<?php echo $this->get_task_id(); ?>'>
							       <?php echo dakindakin(440,nl2br($this->task_content)) ?>
                                </p><!--תקציר של הפניה-->
                              <p id="dakindakin_content<?php echo $this->get_task_id(); ?>"
                                   style="display:none"><?php echo nl2br($this->task_content); ?>
                                <?php if(!empty($this->task_link)){ ?>  <span class="task_link">קישור רלוונטי - <?php echo $this->task_link ?></span>   <?php } ?>
                              </p> 
                             
                            <div id="sbb<?php echo $this->get_task_id(); ?>"    class="status_box_btn">
                             <div id="traficLight"></div>
                                   <span id="postponed<?php echo $this->get_task_id(); ?>" title="נדחה"></span>
                                   <span id="red<?php echo $this->get_task_id(); ?>" title="חדש"></span>
                                   <span id="orange<?php echo $this->get_task_id(); ?>" title="התקבל" ></span>
                                   <span id="yellow<?php echo $this->get_task_id(); ?>" title="בטיפול"></span>
                                   <span id="green<?php echo $this->get_task_id(); ?>" title="בוצע"></span>
                                   <input id="hid_idporject<?php echo $this->get_task_id(); ?>" name="hid_idporject" type="hidden" 
                                   value="<?php echo $this->get_task_id(); ?>" />
                                   <?php if($this->get_status_task()==4 && $this->Close_Date!='0000-00-00'){ ?>
                                <div class="close_task">
                                   <span class="color_turkiz">נסגר על ידי: <?php echo $this->Close_Name?></span>
                                   <span class="color_turkiz"><?php echo $this->Close_Date?></span>
                                   <span class="color_turkiz"><?php echo $this->Close_Time ?></span>
                                </div>   
                                <?php } ?>
                            </div> 
                            <div id="postponed_message<?php echo $this->get_task_id(); ?>" class="comment_div">
                            	<!--<span id="postponed_close" class="box_btn" onclick="close_postponed(<?php // echo $this->get_task_id(); ?>)">-</span>  כפתור סגירה - יוסי לא רוצה -->
                            	<span class="color_turkiz comments_title_span">שליחת סיבת הדחייה</span>
                            	<div id="comments_frame">
                                <div id="comments_content">
                                    <form class="div_reply" id="form_postponed_message<?php echo $this->get_task_id(); ?>" name="form_postponed_message<?php echo $this->get_task_id(); ?>" method="post">
                                    <input id="user_from" name="user_from" type="hidden" value="<?php echo $this->user_id;?>" />
                                     <input id="task_from" name="task_from" type="hidden" value="<?php echo $this->task_id;?>" />
                                    <p id="if_send"></p>
                                    <textarea id="textarea" name="textarea" onfocus="if(this.value=='הזן סיבת דחייה...'){this.value='';}" onblur="if (this.value == '') {this.value = 'הזן סיבת דחייה...';}" >הזן סיבת דחייה...</textarea>  
                                    <div class="reply">
                                    <input class="postponed_send"  id="send_postponed_message<?php echo $this->get_task_id(); ?>"
                                     name="send_postponed_message<?php echo $this->get_task_id(); ?>"
                                      type="button" value="שלח"  />
                                      </div>
                                      </form>
                              </div>
                              </div>
                          </div>
                        
                        <div  id="com<?php echo $this->get_task_id(); ?>" class="comment_div" ><!-- כל התגובות של הפנייה--->
                        <?php if($this->task_attachments!=''){?>
                        	<a target="_blank" href="<?php echo $this->task_attachments; ?>" id="print_screen" class="color_turkiz">צילום מסך </a>
                        <?php }?>
                        <span class="color_turkiz comments_title_span">תגובות</span>
                        <div id="comments_frame">
                         	<div  id="comments_content">
                            <div id="part_comments<?php echo $this->get_task_id(); ?>">
						    <?php  foreach($comments as $com) //com  is class  comments
							 { 
							 ?>
                              <div id="allcom" class="user_type<?php $userRN=user::get_role_type_byid($com->user_id); echo $userRN['role_type'];?>">
                                  <div id="info_com">
                                      <span class="color_turkiz">
                                                <?php   echo $userRN['user_name']; ?>
                                     </span>
                                    </span>
                                     <span class="color_turkiz">
                                     <?php
                                                $time=explode(':',$com->comment_time);
                                                 echo $time[0].':'.$time[1];
                                     ?>
                                     </span>
                                     <span class="color_turkiz">
                                     <?php  
                                              $date=$com->comment_date;
                                              $date=explode('-',$date);
                                              echo $date[2].'/'.$date[1].'/'.$date[0];
                                     ?>
                                     </span>
                                  </div>
                                <span id="print_screen_comments"> 
                                <?php if($com->attachments!=''){?>
                        	<a target="_blank" href="<?php echo $com->attachments; ?>" id="print_screen" class="color_turkiz">צילום מסך </a>
                        <?php }?>
                               </span>
						  	  <P>  <?php  echo nl2br($com->comment_content); ?></P>
                        
                            </div> 
   					      	<?php } ?>
                           </div>
                            <div id="<?php echo $this->get_task_id()?> "  class="div_reply">
                             <textarea onblur="if (this.value == '') {this.value = 'הקלידו תגובה חדשה...';}" onfocus="if(this.value=='הקלידו תגובה חדשה...'){this.value='';}" id="textarea<?php  echo $this->get_task_id() ?>">הקלידו תגובה חדשה...</textarea>
                            <div class="reply"><span id="send_reply" style="float:left"  onclick="send_reply(<?php echo $this->get_task_id() ?>)"> שלח</span>
                            <div id="loading<?php echo $this->get_task_id() ?>" class="load"></div> 
                              <div class="iframe addFileBTN"   src="<?php echo $CRM_uri?>iframe-comments.php?&project=<?php echo $this->project_id; ?>&task=<?php echo $this->get_task_id() ?> "> 
                               הוסף קובץ
                              </div>
                               <!--<iframe id="iframe_file" scrolling="no" src="<?php //echo $CRM_uri?>iframe-comments.php?&project=<?php //echo $this->project_id; ?>&task=<?php //echo $this->get_task_id() ?> " ></iframe>-->
                            </div>
                          </div>
                          </div><!--comments_content-->
                          </div><!-- comments_frame-->
                          
                          
                        </div><!--פרטים של התגובות-->
                         
                        </div><!--- פרטיים של הפניה--> 
			<script>
					 function show(id)
						{
							$('#com'+id).slideToggle();
						  // $('#div_reply'+id).css('display','none');
							if($('#'+id).text()=="+")
							 {
								$('#'+id).text('-');
								$('#dakindakin'+id).css('display','none').delay(1000);
								$('#dakindakin_content'+id).css('display','block').delay(1000);
							 }
							else {
								$('#'+id).text('+');
								$('#dakindakin'+id).css('display','block').delay(700);
								$('#dakindakin_content'+id).css('display','none').delay(1000);
								 }
							
						}
						function open_reply(id_task)
						{   var x='.borderdiv #'+id_task;
							$(x).slideToggle();
							
						}
						function send_reply(id_task)
							{
								var content=$('#textarea'+id_task).val();
								
								insert_message(id_task,content,$('#hidsession').val());
							}
				
		   </script>
             <script>
              $(document).ready(function(e) {
                       
				 var status=<?php echo $this->get_status_task(); ?>;
				 var id=<?php echo $this->task_id; ?>;
				var user_session=$('#hidrole_type').val();
				
				if(user_session==1)//האם המשתמש הוא המנהל
				{
						switch (status)
					   {
						case 1:
						  
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_red.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						case 2:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_Orange.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						 case 3:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_Yellow.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						 case 4:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_green.png) no-repeat top right');
						 break; 
						 case 5:
						   $('#postponed'+id).css('background','url(./style/images/deny_x_active.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   
					    break;  
						
					 };
					/****************/
					
					 $('#red'+id).click(function (){var x=true//confirm(' אתה בטוח שאתה רוצה לשנות סטאטוס ');
						if(x) { change_status_task(1,$('#hid_idporject'+id).val(),id);} ;
						  });
				   $('#orange'+id).click(function (){var x=true//confirm(' אתה בטוח שאתה רוצה לשנות סטאטוס ');
						if(x){change_status_task(2,$('#hid_idporject'+id).val(),id);};
						
						});
					 $('#yellow'+id).click(function (){var x=true//confirm(' אתה בטוח שאתה רוצה לשנות סטאטוס ');
						if(x) { change_status_task(3,$('#hid_idporject'+id).val(),id);} ;
						  });
					
					$('#green'+id).click(function (){var x=true//confirm(' אתה בטוח שאתה רוצה לשנות סטאטוס ');
					if(x){change_status_task(4,$('#hid_idporject'+id).val(),id);};
					});
                   $('#postponed'+id).click(function (){var x=true//confirm(' אתה בטוח שאתה רוצה לשנות סטאטוס ');
					if(x)
						{
								$('#postponed_message'+id).show();
								
								change_status_task(5,$('#hid_idporject'+id).val(),id);
					    };
					});
					$('#send_postponed_message'+id).click(function(e) {
                   
					  var info=$('#form_postponed_message'+id).serialize();
					  send_mail_postponed(info,id);
                });	
				$('#close').click(function(e) {
                    $('#postponed_message'+id).hide();
                });
				 
				  
				}
				else
				{
					 
				if(user_session==2 || user_session==3 || user_session==6)//האם המשתמש הוא תכניתן אוו QA 
					{
						
					switch (status)
					   {
						case 1:
						  
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_red.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						case 2:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_Orange.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						 case 3:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_Yellow.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						 case 4:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_green.png) no-repeat top right');
						 break; 
						    case 5:
						   $('#postponed'+id).css('background','url(./style/images/deny_x_active.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   
					    break;  
					 };
					/****************/
					
						if( status!=5 & status!=1)
						 {
						     $('#orange'+id).click(function (){var x=true//confirm(' אתה בטוח שאתה רוצה לשנות סטאטוס ');
								if(x){change_status_task(2,$('#hid_idporject'+id).val(),id);};
								
								});
							 $('#yellow'+id).click(function (){var x=true//confirm(' אתה בטוח שאתה רוצה לשנות סטאטוס ');
								if(x) { change_status_task(3,$('#hid_idporject'+id).val(),id);} ;
								  });
							
							$('#green'+id).click(function (){var x=true//confirm(' אתה בטוח שאתה רוצה לשנות סטאטוס ');
							if(x){change_status_task(4,$('#hid_idporject'+id).val(),id);};
							});
						 }
				  }
			
				else 
				   { 
						switch (status)
					   {
						case 1:
						  
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_red.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						case 2:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_Orange.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						 case 3:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_Yellow.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						 break;  
						 case 4:
						   $('#postponed'+id).css('background','url(./style/images/deny_x.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_green.png) no-repeat top right');
						 break; 
					   case 5:
						   $('#postponed'+id).css('background','url(./style/images/deny_x_active.png) no-repeat top right');
						   $('#red'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#yellow'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#orange'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   $('#green'+id).css('background','url(./style/images/status_btn_gray.png) no-repeat top right');
						   
					    break;      
					 };
				   
				   }
				   }
                        });
          </script>
        
		<?php
			}
	
 }//end if task_project_status!=1
}

?>